<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            border: solid;
            padding: 10px;
        }
    </style>
</head>

<body>

    <div id="box1">
        box1
        <div id="box2">
            box2
            <div id="box3">
                box3
                <div id="box4">
                    box4
                </div>
            </div>
        </div>
    </div>

    <script>
        const box1 = document.getElementById('box1');
        const box2 = document.getElementById('box2');
        const box3 = document.getElementById('box3');
        const box4 = document.getElementById('box4');


        box1.addEventListener('click', () => {
            console.log(1);
        })
        box2.addEventListener('click', () => {
            console.log(2);
        })
        box3.addEventListener('click', () => {
            console.log(3);
        })
        box4.addEventListener('click', () => {
            console.log(4);
        })



        box1.addEventListener('click', () => {
            console.log('c', 1);
        }, { capture: true })
        box2.addEventListener('click', () => {
            console.log('c', 2);
        }, { capture: true })
        box3.addEventListener('click', () => {
            console.log('c', 3);
        }, { capture: true })
        box4.addEventListener('click', () => {
            console.log('c', 4);
        }, true)


    </script>

</body>

</html>